﻿Public Class ExternalMenu

    Public Sub UnrealEditorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim proc As New Process()
        Dim startinfo As New ProcessStartInfo()
        startinfo.FileName = Globals.CurrentProject.ProjectFolder + "\Binaries\UDKLift.exe"
        startinfo.Arguments = "editor"
        startinfo.WorkingDirectory = Globals.CurrentProject.ProjectFolder + "\Binaries\"
        proc.StartInfo = startinfo
        proc.Start()
    End Sub

    Public Sub UnrealLocalizerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim proc As New Process()
        Dim startinfo As New ProcessStartInfo()
        startinfo.FileName = Globals.CurrentProject.ProjectFolder + "\Binaries\UnrealLoc.exe"
        startinfo.WorkingDirectory = Globals.CurrentProject.ProjectFolder + "\Binaries\"
        proc.StartInfo = startinfo
        proc.Start()
    End Sub

    Public Sub UnrealFrontendToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim proc As New Process()
        Dim startinfo As New ProcessStartInfo()
        startinfo.FileName = Globals.CurrentProject.ProjectFolder + "\Binaries\UnrealFrontend.exe"
        startinfo.WorkingDirectory = Globals.CurrentProject.ProjectFolder + "\Binaries\"
        proc.StartInfo = startinfo
        proc.Start()
    End Sub

    Public Sub OpenConfigFolderToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim proc As New Process
        Dim startinfo As New ProcessStartInfo
        startinfo.FileName = Globals.kDefaultExplorer
        startinfo.Arguments = Globals.CurrentProject.ProjectFolder + "UDKGame\Config"
        proc.StartInfo = startinfo
        proc.Start()
    End Sub

    Public Sub OpenExplorerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim proc As New Process
        Dim startinfo As New ProcessStartInfo
        startinfo.FileName = Globals.kDefaultExplorer
        startinfo.Arguments = Globals.CurrentProject.DevelopmentFolder
        proc.StartInfo = startinfo
        proc.Start()
    End Sub

    Public Sub OpenTerminalToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim proc As New Process
        Dim startinfo As New ProcessStartInfo
        Dim curdir As String = IO.Directory.GetCurrentDirectory()
        startinfo.FileName = curdir + Globals.kDefaultTerminal

        ' Add in directories to the PATH
        startinfo.Arguments = """" + curdir + """" + " " + """" + curdir + "\scripts" + """"
        If Not IsNothing(Globals.CurrentProject) Then
            startinfo.Arguments += " " + """" + Globals.CurrentProject.ProjectFolder + "Binaries" + """"
        End If

        startinfo.WorkingDirectory = Globals.CurrentProject.ProjectFolder

        proc.StartInfo = startinfo
        proc.Start()
    End Sub

End Class
